<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div class="box" id="box">哈哈
        <p>我会p</p>
        <span>我是span</span>
        <a href="#">我是a</a>hehe
    </div>

    <script>
        var box = document.getElementById('box')
        var p = document.getElementsByTagName('p')[0]
        var childs = box.children
        // console.log(childs)
        // for(var i=0;i<childs.length;i++){
        //     childs[i].style.backgroundColor = 'pink'
        // }
        // console.log(box.firstChild)
        // console.log(box.lastChild)h
        console.log(box.parentNode)
        console.log(p.parentNode.nodeType)
        console.log(p.parentNode.nodeName)
        console.log(p.parentNode.nodeVaue)
        console.log(box.childNodes)
        console.log(box.children)
        console.log(p.innerText)
        // console.log(p.parentElement)
    </script>
</body>

</html>